﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace OtherDevice.UserDefineCtrl
{
    public partial class Form_Scan : Form_ControlBase
    {
        public Form_Scan()
        {
            InitializeComponent();
        }
        SNTcpIpBase scan = null;
        public override void FlushToDlg(object devicebase)
        {
            try
            {
                if (devicebase == null)
                    return;
                this.scan = devicebase as SNTcpIpBase;
                this.Dock = DockStyle.Fill;
                this.Show();
            }
            catch (Exception)
            {

            }

        }

        private void btn_TriggerScan_Click_1(object sender, EventArgs e)
        {
            try
            {
                string strSN = string.Empty;
                int n_Time = Convert.ToInt32(txt_接收时间.Text);
                int n_Length = Convert.ToInt32(txt_SNLength.Text);
                scan.Fucntion_获取SN码(n_Length, ref strSN, n_Time);
                lbl_SN.Text = $"SN：{strSN}";
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
}
